home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1283 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.internetMCI.com!news-admin
  2. From: Bret Hill <bhill@lanier.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Subclass edit control for date in windows?
  5. Date: 12 Jan 1996 20:51:58 GMT
  6. Organization: InternetMCI
  7. Message-ID: <4d6hle$qmf@news.internetmci.com>
  8. NNTP-Posting-Host: usr1-dialup9.atlanta.mci.net
  9.  
  10. First of all I, as a new internet user, would like to know if I am
  11. in the proper newsgroup to be asking this next question.
  12.  
  13. Does anyone have a decent proc for subclassing edit controls for
  14. dates?
  15.  
  16. I am currently subclassing an edit controll on a dialog box for a
  17. date field.  It's very simple right now:  On a WM_CHAR I send the
  18. message to the old edit proc, I then reformat the text in the edit 
  19. box (take out letters, put in slashes). Example:
  20.  
  21. switch (message)
  22. {
  23.   case WM_CHAR:
  24.     CallWindowProc(lpfnOldEditProc,hWnd,message,wParam,lParam);
  25.     GetWindowText(hWnd,datestr,14);
  26.  
  27.     i=MaskDate(datestr);  // (my date formatting function)
  28.     SetWindowText(hWnd,datestr);                
  29.     return 0;
  30. }
  31. return CallWindowProc(lpfnOldEditProc,hWnd,message,wParam,lParam);
  32.  
  33. I'm having problems with the positioning of the text cursor after
  34. the SetWindowText.  I've tried several ways to get the text cursor
  35. to the proper position, but it boils down to sending multiple VK_RIGHT
  36. messages to the OldEditProc which doesn't work to well.
  37.  
  38. Suggestions or Ideas?
  39.  
  40.